import 'package:flutter/material.dart';

import 'my_theme.dart';

// class __BgInput extends StatelessWidget {
//   // 提示文字
//   String hintText = '';
//
//   // 密码加密
//   bool obscureText = false;
//   FormFieldValidator<String>? validator;
//
//   // 键盘类型
//   TextInputType keyboardType = TextInputType.text;
//
//   @override
//   Widget build(BuildContext context) {
//     return Container(
//       // padding: EdgeInsets.only(left: 18, right: 18),
//       // height: 44,
//       // decoration: BoxDecoration(
//       //     color: MyTheme.inputBackgroundColor,
//       //     borderRadius: BorderRadius.circular(22)),
//       child: TextFormBgField(hintText,
//           obscureText: obscureText,
//           keyboardType: keyboardType,
//           validator: validator),
//     );
//   }
//
//   __BgInput(
//       {this.hintText = '',
//       this.obscureText = false,
//       this.keyboardType = TextInputType.text,
//       this.validator});
// }

class BgInput extends TextFormField {
  String? hintText = '';
  bool obscureText = false;
  FormFieldValidator<String>? validator;
  FormFieldSetter<String>? onSaved;
  TextInputType keyboardType = TextInputType.text;
  String initialValue;

  BgInput(
      {this.initialValue = '',
      this.hintText,
      this.onSaved,
      this.obscureText = false,
      this.keyboardType = TextInputType.text,
      this.validator})
      : super(
            initialValue: initialValue,
            obscureText: obscureText,
            keyboardType: keyboardType,
            maxLength: 20,
            cursorRadius: Radius.circular(30),
            cursorColor: Colors.black,
            decoration: InputDecoration(
              hintText: hintText,
              counterText: '',
              //隐藏下划线,
              enabledBorder: OutlineInputBorder(
                  borderRadius: BorderRadius.all(Radius.circular(22)),
                  borderSide: BorderSide(
                    width: 0,
                    color: MyTheme.inputBackgroundColor,
                  )),
              focusedBorder: OutlineInputBorder(
                  borderRadius: BorderRadius.all(Radius.circular(22)),
                  borderSide: BorderSide(
                    width: 0,
                    color: MyTheme.inputBackgroundColor,
                  )),
            ),
            validator: validator,
            onSaved: onSaved);
}
